package org.github.manx98.jlibhac.fssystem;

import org.github.manx98.jlibhac.fs.IStorage;
import org.github.manx98.jlibhac.fs.SubStorage;
import org.github.manx98.jlibhac.fs.fsa.IFile;

import java.io.IOException;

/**
 * @author Manx98
 * @version 1.0
 * @since 2022/10/3 13:21
 */
public class PartitionFile extends IFile {
    private final SubStorage baseStorage;

    public PartitionFile(IStorage storage, long offset, long size) {
        super(0);
        this.baseStorage = new SubStorage(storage, offset, size);
    }

    @Override
    public void read(long offset, byte[] destination, int destOffset, int len) throws IOException {
        this.baseStorage.read(offset, destination, destOffset, len);
    }

    @Override
    public long getSize() {
        return this.baseStorage.getSize();
    }
}
